<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/blog/images/logo.svg" color="#222">

<link rel="stylesheet" href="/blog/css/main.css">

<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic|LiSu:300,300italic,400,400italic,700,700italic|youyuan:300,300italic,400,400italic,700,700italic&display=swap&subset=latin,latin-ext">
<link rel="stylesheet" href="/blog/lib/font-awesome/css/font-awesome.min.css">
  <link rel="stylesheet" href="/blog/lib/pace/pace-theme-bounce.min.css">
  <script src="/blog/lib/pace/pace.min.js"></script>

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"zchao666.gitee.io","root":"/blog/","scheme":"Gemini","version":"7.7.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="表单标签库表单标签库中包含了可以用在JSP页面中渲染HTML元素的标签。在JSP页面使用表单标签库时，需要在JSP页面开头处声明taglib指令：&lt;%@ taglib prefix&#x3D;&quot;form&quot; uri&#x3D;&quot;http:&#x2F;&#x2F;www.springframework.org&#x2F;tags&#x2F;form&quot; %&gt; form表单标签form表单标签是渲染表单元素，具体">
<meta property="og:type" content="article">
<meta property="og:title" content="表单标签库与数据绑定">
<meta property="og:url" content="https://zchao666.gitee.io/blog/2020/03/08/%E8%A1%A8%E5%8D%95%E6%A0%87%E7%AD%BE%E5%BA%93%E4%B8%8E%E6%95%B0%E6%8D%AE%E7%BB%91%E5%AE%9A/index.html">
<meta property="og:site_name" content="小郭的博客">
<meta property="og:description" content="表单标签库表单标签库中包含了可以用在JSP页面中渲染HTML元素的标签。在JSP页面使用表单标签库时，需要在JSP页面开头处声明taglib指令：&lt;%@ taglib prefix&#x3D;&quot;form&quot; uri&#x3D;&quot;http:&#x2F;&#x2F;www.springframework.org&#x2F;tags&#x2F;form&quot; %&gt; form表单标签form表单标签是渲染表单元素，具体">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://img-blog.csdnimg.cn/20200308195243386.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQxMTkzMTMz,size_16,color_FFFFFF,t_70">
<meta property="article:published_time" content="2020-03-08T11:57:22.000Z">
<meta property="article:modified_time" content="2020-03-08T12:00:02.599Z">
<meta property="article:author" content="小郭">
<meta property="article:tag" content="Java">
<meta property="article:tag" content="表单标签库">
<meta property="article:tag" content="数据绑定">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://img-blog.csdnimg.cn/20200308195243386.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQxMTkzMTMz,size_16,color_FFFFFF,t_70">

<link rel="canonical" href="https://zchao666.gitee.io/blog/2020/03/08/%E8%A1%A8%E5%8D%95%E6%A0%87%E7%AD%BE%E5%BA%93%E4%B8%8E%E6%95%B0%E6%8D%AE%E7%BB%91%E5%AE%9A/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true
  };
</script>

  <title>表单标签库与数据绑定 | 小郭的博客</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

  
  
		<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
		<script>
		/* 社会主体核心价值观效果 */
		var a_idx = 0;
		jQuery(document).ready(function ($) {
		  $("body").click(function (e) {
			var a = new Array("富强", "民主", "文明", "和谐", "自由", "平等", "公正", "法治", "爱国", "敬业", "诚信", "友善");
			var $i = $("<span/>").text(a[a_idx]);
			a_idx = (a_idx + 1) % a.length;
			var x = e.pageX,
			  y = e.pageY;
			$i.css({
			  "z-index": 100000000,
			  "top": y - 20,
			  "left": x,
			  "position": "absolute",
			  "font-family": "LiSu",
			  "font-weight": "bold",
			  "color": "#ff6651"
			});
			$("body").append($i);
			$i.animate({
			  "top": y - 180,
			  "opacity": 0
			}, 1500, function () {
			  $i.remove();
			});
		  });
		});
	</script>
  

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <div>
      <a href="/blog/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">小郭的博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/blog/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/blog/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/blog/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/blog/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/blog/about/" rel="section"><i class="fa fa-fw fa-user"></i>关于</a>

  </li>
        <li class="menu-item menu-item-留言">

    <a href="/blog/comments/" rel="section"><i class="fa fa-fw fa-commenting"></i>留言</a>

  </li>
        <li class="menu-item menu-item-commonweal">

    <a href="/blog/404/" rel="section"><i class="fa fa-fw fa-heartbeat"></i>公益 404</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>

</nav>
  <div class="site-search">
    <div class="popup search-popup">
    <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocorrect="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result"></div>

</div>
<div class="search-pop-overlay"></div>

  </div>
</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>

  <a href="https://github.com/GZC986707252" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content">
            

  <div class="posts-expand">
      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block " lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://zchao666.gitee.io/blog/2020/03/08/%E8%A1%A8%E5%8D%95%E6%A0%87%E7%AD%BE%E5%BA%93%E4%B8%8E%E6%95%B0%E6%8D%AE%E7%BB%91%E5%AE%9A/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/blog/uploads/avatar.jpg">
      <meta itemprop="name" content="小郭">
      <meta itemprop="description" content="一个还在不断学习的编程小白！">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="小郭的博客">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          表单标签库与数据绑定
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              

              <time title="创建时间：2020-03-08 19:57:22 / 修改时间：20:00:02" itemprop="dateCreated datePublished" datetime="2020-03-08T19:57:22+08:00">2020-03-08</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/blog/categories/SpringMVC%E5%AD%A6%E4%B9%A0/" itemprop="url" rel="index"><span itemprop="name">SpringMVC学习</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span>
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="fa fa-comment-o"></i>
      </span>
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/blog/2020/03/08/%E8%A1%A8%E5%8D%95%E6%A0%87%E7%AD%BE%E5%BA%93%E4%B8%8E%E6%95%B0%E6%8D%AE%E7%BB%91%E5%AE%9A/#valine-comments" itemprop="discussionUrl">
      <span class="post-comments-count valine-comment-count" data-xid="/blog/2020/03/08/%E8%A1%A8%E5%8D%95%E6%A0%87%E7%AD%BE%E5%BA%93%E4%B8%8E%E6%95%B0%E6%8D%AE%E7%BB%91%E5%AE%9A/" itemprop="commentCount"></span>
    </a>
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h3 id="表单标签库"><a href="#表单标签库" class="headerlink" title="表单标签库"></a>表单标签库</h3><p>表单标签库中包含了可以用在JSP页面中渲染HTML元素的标签。在JSP页面使用表单标签库时，需要在JSP页面开头处声明taglib指令：<br><code>&lt;%@ taglib prefix=&quot;form&quot; uri=&quot;http://www.springframework.org/tags/form&quot; %&gt;</code></p>
<h4 id="form表单标签"><a href="#form表单标签" class="headerlink" title="form表单标签"></a>form表单标签</h4><p>form表单标签是渲染表单元素，具体语法格式：</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">form:form</span> <span class="attr">modelAttribute</span>=<span class="string">"xxx"</span> <span class="attr">method</span>=<span class="string">"xxx"</span> <span class="attr">action</span>=<span class="string">"xxx"</span>&gt;</span></span><br><span class="line">	...</span><br><span class="line"><span class="tag">&lt;/<span class="name">from:from</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>表单标签除了具有HTML表单元素属性以外，还具有acceptCharset、commandName、cssClass、cssStyle、htmlEscape和modelAttribute等属性。</p>
<a id="more"></a>

<ul>
<li><code>acceptCharset</code> ：定义服务器接受的字符编码列表。</li>
<li><code>commandName</code>：暴露表单对象的模型属性名称，默认值为command。</li>
<li><code>cssClass</code>：定义应用到from元素的CSS类。</li>
<li><code>cssStyle</code>：定义应用到form元素的CSS样式。</li>
<li><code>htmlEscape</code>：true或false，表示是否进行HTML转义。</li>
<li><code>modelAttribute</code>：暴露form backing object 的模型属性名称，默认值为command。<br>其中，<code>commandName</code>和<code>modelAttribute</code>的功能基本一样，属性值绑定一个JavaBean对象。假设控制器类UserController的方法inputUser是返回userAdd.jsp的请求处理方法，如下所示：</li>
</ul>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">RequestMapping(<span class="string">"/input"</span>)</span><br><span class="line"><span class="function"><span class="keyword">public</span> String <span class="title">inputUser</span><span class="params">(HttpServletRequest request, HttpServletResponse response, Model model)</span></span>&#123;</span><br><span class="line">    <span class="comment">//如果model中没有user属性，userAdd.jsp会抛异常，因为表单标签无法找到modelArrtibute属性指定的form backing object</span></span><br><span class="line">    model.addAttribute(<span class="string">"user"</span>, <span class="keyword">new</span> User());</span><br><span class="line">    <span class="keyword">return</span> <span class="string">"userAdd"</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>那么userAdd.jsp中的表单标签应该是这样：</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">form:form</span> <span class="attr">modelAttribute</span>=<span class="string">"user"</span> <span class="attr">method</span>=<span class="string">"post"</span> <span class="attr">action</span>=<span class="string">"$&#123;pageContext.request.contextPath&#125;/user/save"</span>&gt;</span></span><br><span class="line">...</span><br><span class="line"><span class="tag">&lt;/<span class="name">form:form</span>&gt;</span></span><br></pre></td></tr></table></figure>
<h4 id="input标签、password标签、hidden标签、textarea标签"><a href="#input标签、password标签、hidden标签、textarea标签" class="headerlink" title="input标签、password标签、hidden标签、textarea标签"></a>input标签、password标签、hidden标签、textarea标签</h4><p><strong>input标签</strong>：<code>&lt;form:input path=&quot;xxx&quot;/&gt;</code><br>该标签除了具有cssClass、cssStyle、htmlEscape属性以外，还有一个最重要的属性<code>path</code>。path属性将文本框输入值绑定到form backing object 对象的一个属性。例如：</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">form:form</span> <span class="attr">modelAttribute</span>=<span class="string">"user"</span> <span class="attr">method</span>=<span class="string">"post"</span> <span class="attr">action</span>=<span class="string">"$&#123;pageContext.request.contextPath&#125;/user/save"</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">form:input</span> <span class="attr">path</span>=<span class="string">"userName"</span>/&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">form:form</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>上述代码将输入值绑定到user对象的userName属性。</p>
<p><strong>password标签、hidden标签、textarea标签</strong>的用法和<strong>input标签</strong>基本一致。但要注意的是<strong>hidden标签</strong>不能显示，不支持cssClass、cssStyle属性。</p>
<h4 id="checkbox标签-、checkboxes标签"><a href="#checkbox标签-、checkboxes标签" class="headerlink" title="checkbox标签 、checkboxes标签"></a>checkbox标签 、checkboxes标签</h4><p><strong>checkbox标签：</strong><code>&lt;form:checkbox path=&quot;xxx&quot; value=&quot;xxx&quot;/&gt;</code><br>多个path相同的checkbox标签，它们是一个选项组，允许多选，选项值绑定到一个数组属性。</p>
<p><strong>checkboxes标签：</strong><code>&lt;form:checkboxes path=&quot;xxx&quot; items=&quot;xxx&quot;/&gt;</code><br>checkboxes标签等价于多个相同path的checkbox标签。它有3个重要属性：</p>
<ul>
<li><code>items</code> ：用于生成input元素的Collection、Map或者Array。</li>
<li><code>itemLabel</code>：items属性中指定的集合对象的属性，为每个input元素提供label。</li>
<li><code>itemValue</code>：items属性中指定的集合对象的属性，为每个input元素提供value。</li>
</ul>
<p>例如：</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">form:checkboxes</span> <span class="attr">path</span>=<span class="string">"hobbies"</span> <span class="attr">items</span>=<span class="string">"$&#123;hobbies&#125;"</span>/&gt;</span></span><br></pre></td></tr></table></figure>
<p>上述代码将model的属性hobbies（集合元素）渲染成多个复选框。在<em>itemLabel</em>属性和<em>itemValue</em>属性省略情况下，如果集合是数组，则复选框的<em>label</em>和<em>value</em>相同；如果集合是Map，则复选框的label是Map的值（value），复选框的value是Map的关键字（key）。</p>
<h4 id="radiobutton标签-、radiobuttons标签"><a href="#radiobutton标签-、radiobuttons标签" class="headerlink" title="radiobutton标签 、radiobuttons标签"></a>radiobutton标签 、radiobuttons标签</h4><p><strong>radiobutton标签：</strong><code>&lt;form:radiobutton path=&quot;xxx&quot; value=&quot;xxx&quot;/&gt;</code><br>多个path相同的radiobutton标签，是一个选项组，只允许单选。</p>
<p><strong>radiobuttons标签：</strong><code>&lt;form:radiobuttons path=&quot;xxx&quot; items=&quot;xxx&quot;/&gt;</code><br>该标签等价于多个path相同的radiobutton标签，渲染多个radio。<br>其中<em>itemLabel</em>属性和<em>itemValue</em>属性用法与checkboxs标签完全一样，但是只允许单选。</p>
<h4 id="select标签-、options标签"><a href="#select标签-、options标签" class="headerlink" title="select标签 、options标签"></a>select标签 、options标签</h4><p><strong>select标签</strong>的选项可以来自其属性<code>items</code>指定的集合，也可以来自嵌套的option标签或options标签。语法格式如下：</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">form:select</span> <span class="attr">path</span>=<span class="string">"xxx"</span> <span class="attr">items</span>=<span class="string">"xxx"</span>/&gt;</span></span><br></pre></td></tr></table></figure>
<p>或者</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">form:select</span> <span class="attr">path</span>=<span class="string">"xxx"</span> <span class="attr">items</span>=<span class="string">"xxx"</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">option</span> <span class="attr">value</span>=<span class="string">"xxx"</span>&gt;</span>xxx<span class="tag">&lt;/<span class="name">option</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">form:select</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>或者</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">form:select</span> <span class="attr">path</span>=<span class="string">"xxx"</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">form:options</span> <span class="attr">items</span>=<span class="string">"xxx"</span>/&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">form:select</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p><strong>options标签</strong>用于生成一个select标签的选项列表，需要和select标签一同使用。</p>
<h4 id="errors标签"><a href="#errors标签" class="headerlink" title="errors标签"></a>errors标签</h4><p>errors标签用于渲染一个或多个span元素，每个span元素包含一个错误消息。该标签可以用于显示一个特定的错误消息，也可以显示所有错误消息。</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">&lt;!--显示所有错误消息--&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">form:errors</span> <span class="attr">path</span>=<span class="string">"*"</span>/&gt;</span></span><br><span class="line">或者</span><br><span class="line"><span class="comment">&lt;!--显示由"xxx"指定的特定错误消息--&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">form:errors</span> <span class="attr">path</span>=<span class="string">"xxx"</span>/&gt;</span></span><br></pre></td></tr></table></figure>
<h3 id="数据绑定的应用"><a href="#数据绑定的应用" class="headerlink" title="数据绑定的应用"></a>数据绑定的应用</h3><p><strong>这里仅仅列举部分关键代码，方便理解上述的表单标签库的使用和数据绑定。</strong></p>
<ul>
<li><strong>UserController控制器</strong><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Controller</span></span><br><span class="line"><span class="meta">@RequestMapping</span>(<span class="string">"/user"</span>)</span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">UserController</span> </span>&#123;</span><br><span class="line">    <span class="comment">//得到一个用来记录日志信息的对象，这样在打印信息的时候能够标记打印的是哪个类的信息</span></span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> Log logger = LogFactory.getLog(UserController<span class="class">.<span class="keyword">class</span>)</span>;</span><br><span class="line">    <span class="meta">@Autowired</span></span><br><span class="line">    <span class="keyword">private</span> UserService userService;</span><br><span class="line">    <span class="meta">@RequestMapping</span>(<span class="string">"/input"</span>)</span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">inputUser</span><span class="params">(HttpServletRequest request, HttpServletResponse response, Model model)</span></span>&#123;</span><br><span class="line">        HashMap&lt;String, String&gt; hobbies = <span class="keyword">new</span> HashMap&lt;String, String&gt;();</span><br><span class="line">        hobbies.put(<span class="string">"篮球"</span>, <span class="string">"basketball"</span>);</span><br><span class="line">        hobbies.put(<span class="string">"乒乓球"</span>, <span class="string">"乒乓球"</span>);</span><br><span class="line">        hobbies.put(<span class="string">"电玩"</span>, <span class="string">"电玩"</span>);</span><br><span class="line">        hobbies.put(<span class="string">"游泳"</span>, <span class="string">"游泳"</span>);</span><br><span class="line">        <span class="comment">//如果model中没有user属性，userAdd.jsp会抛异常，因为表单标签无法找到modelArrtibute属性指定的form backing object</span></span><br><span class="line">        model.addAttribute(<span class="string">"user"</span>, <span class="keyword">new</span> User());</span><br><span class="line">        model.addAttribute(<span class="string">"hobbies"</span>, hobbies);</span><br><span class="line">        model.addAttribute(<span class="string">"carrer"</span>, <span class="keyword">new</span> String[]&#123;<span class="string">"教师"</span>, <span class="string">"学生"</span>, <span class="string">"程序员"</span>, <span class="string">"IT民工"</span>, <span class="string">"其他"</span>&#125;);</span><br><span class="line">        <span class="keyword">return</span> <span class="string">"userAdd"</span>;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="meta">@RequestMapping</span>(<span class="string">"/save"</span>)</span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">addUser</span><span class="params">(@ModelAttribute User user, Model model)</span> </span>&#123;</span><br><span class="line">        System.out.println(user);</span><br><span class="line">        <span class="keyword">if</span> (userService.addUser(user)) &#123;</span><br><span class="line">            logger.info(<span class="string">"成功"</span>);</span><br><span class="line">            <span class="comment">//重定向到/user/list遍历users</span></span><br><span class="line">            <span class="keyword">return</span> <span class="string">"redirect:/user/list"</span>;</span><br><span class="line">        &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">            logger.info(<span class="string">"失败"</span>);</span><br><span class="line">            HashMap&lt;String, String&gt; hobbies = <span class="keyword">new</span> HashMap&lt;String, String&gt;();</span><br><span class="line">            hobbies.put(<span class="string">"篮球"</span>, <span class="string">"basketball"</span>);</span><br><span class="line">            hobbies.put(<span class="string">"乒乓球"</span>, <span class="string">"乒乓球"</span>);</span><br><span class="line">            hobbies.put(<span class="string">"电玩"</span>, <span class="string">"电玩"</span>);</span><br><span class="line">            hobbies.put(<span class="string">"游泳"</span>, <span class="string">"游泳"</span>);</span><br><span class="line">            <span class="comment">//这里不需要model.addAttribute("user", new User())，因为@ModelAttribute已经指定</span></span><br><span class="line">            model.addAttribute(<span class="string">"hobbies"</span>, hobbies);</span><br><span class="line">            model.addAttribute(<span class="string">"carrer"</span>, <span class="keyword">new</span> String[]&#123;<span class="string">"教师"</span>, <span class="string">"学生"</span>, <span class="string">"程序员"</span>, <span class="string">"IT民工"</span>, <span class="string">"其他"</span>&#125;);</span><br><span class="line">            <span class="keyword">return</span> <span class="string">"userAdd"</span>;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="meta">@RequestMapping</span>(<span class="string">"/list"</span>)</span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">listUser</span><span class="params">(Model model)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">for</span> (User user:userService.getUsers()) &#123;</span><br><span class="line">            System.out.println(user);</span><br><span class="line">        &#125;</span><br><span class="line">        model.addAttribute(<span class="string">"users"</span>, userService.getUsers());</span><br><span class="line">        <span class="keyword">return</span> <span class="string">"userList"</span>;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<ul>
<li><strong>userAdd.jsp</strong></li>
</ul>
</li>
</ul>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br></pre></td><td class="code"><pre><span class="line">&lt;%@ page contentType=<span class="string">"text/html;charset=UTF-8"</span> language=<span class="string">"java"</span> %&gt;</span><br><span class="line">&lt;%@ taglib prefix=<span class="string">"form"</span> uri=<span class="string">"http://www.springframework.org/tags/form"</span> %&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">&lt;head&gt;</span><br><span class="line">    &lt;title&gt;添加User&lt;/title&gt;</span><br><span class="line">&lt;/head&gt;</span><br><span class="line">&lt;body&gt;</span><br><span class="line">&lt;form:form modelAttribute=<span class="string">"user"</span> method=<span class="string">"post"</span> action=<span class="string">"$&#123;pageContext.request.contextPath&#125;/user/save"</span>&gt;</span><br><span class="line">    &lt;fieldset&gt;</span><br><span class="line">        &lt;legend&gt;添加一个用户&lt;/legend&gt;</span><br><span class="line">        &lt;p&gt;</span><br><span class="line">            &lt;label&gt;用户名：&lt;/label&gt;</span><br><span class="line">            &lt;form:input path=<span class="string">"userName"</span>/&gt;</span><br><span class="line">        &lt;/p&gt;</span><br><span class="line">        &lt;p&gt;</span><br><span class="line">            &lt;label&gt;爱好：&lt;/label&gt;</span><br><span class="line">            &lt;form:checkboxes path=<span class="string">"hobbies"</span> items=<span class="string">"$&#123;hobbies&#125;"</span>/&gt;</span><br><span class="line">        &lt;/p&gt;</span><br><span class="line">        &lt;p&gt;</span><br><span class="line">            &lt;label&gt;朋友：&lt;/label&gt;</span><br><span class="line">            &lt;form:checkbox path=<span class="string">"friends"</span> value=<span class="string">"张三"</span>/&gt;张三</span><br><span class="line">            &lt;form:checkbox path=<span class="string">"friends"</span> value=<span class="string">"李四"</span>/&gt;李四</span><br><span class="line">            &lt;form:checkbox path=<span class="string">"friends"</span> value=<span class="string">"王五"</span>/&gt;王五</span><br><span class="line">            &lt;form:checkbox path=<span class="string">"friends"</span> value=<span class="string">"赵六"</span>/&gt;赵六</span><br><span class="line">        &lt;/p&gt;</span><br><span class="line">        &lt;p&gt;</span><br><span class="line">            &lt;label&gt;职业：&lt;/label&gt;</span><br><span class="line">            &lt;form:select path=<span class="string">"carrer"</span>&gt;</span><br><span class="line">                &lt;option&gt;请选择职业&lt;/option&gt;</span><br><span class="line">                &lt;form:options items=<span class="string">"$&#123;carrer&#125;"</span>/&gt;</span><br><span class="line">            &lt;/form:select&gt;</span><br><span class="line">        &lt;/p&gt;</span><br><span class="line">        &lt;p&gt;</span><br><span class="line">            &lt;label&gt;个人描述：&lt;/label&gt;</span><br><span class="line">            &lt;form:textarea path=<span class="string">"remark"</span> rows=<span class="string">"5"</span>/&gt;</span><br><span class="line">        &lt;/p&gt;</span><br><span class="line">        &lt;p&gt;</span><br><span class="line">            &lt;button type="reset"&gt;重置&lt;/button&gt;</span><br><span class="line">            &lt;button type="submit"&gt;添加&lt;/button&gt;</span><br><span class="line">        &lt;/p&gt;</span><br><span class="line">    &lt;/fieldset&gt;</span><br><span class="line">&lt;/form:form&gt;</span><br><span class="line">&lt;/body&gt;</span><br><span class="line">&lt;/html&gt;</span><br></pre></td></tr></table></figure>
<p>运行结果图：<br><img src="https://img-blog.csdnimg.cn/20200308195243386.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQxMTkzMTMz,size_16,color_FFFFFF,t_70" alt="在这里插入图片描述"></p>

    </div>

    
    
    
        <div class="reward-container">
  <div></div>
  <button onclick="var qr = document.getElementById('qr'); qr.style.display = (qr.style.display === 'none') ? 'block' : 'none';">
    打赏
  </button>
  <div id="qr" style="display: none;">
      
      <div style="display: inline-block;">
        <img src="/blog/uploads/wechatpay.jpg" alt="小郭 微信支付">
        <p>微信支付</p>
      </div>

  </div>
</div>


      <footer class="post-footer">
          
          <div class="post-tags">
              <a href="/blog/tags/Java/" rel="tag"><i class="fa fa-tag"></i> Java</a>
              <a href="/blog/tags/%E8%A1%A8%E5%8D%95%E6%A0%87%E7%AD%BE%E5%BA%93/" rel="tag"><i class="fa fa-tag"></i> 表单标签库</a>
              <a href="/blog/tags/%E6%95%B0%E6%8D%AE%E7%BB%91%E5%AE%9A/" rel="tag"><i class="fa fa-tag"></i> 数据绑定</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/blog/2020/03/08/%E8%87%AA%E5%AE%9A%E4%B9%89%E7%B1%BB%E5%9E%8B%E8%BD%AC%E6%8D%A2%E4%B8%8E%E6%A0%BC%E5%BC%8F%E5%8C%96/" rel="prev" title="自定义类型转换与格式化">
      <i class="fa fa-chevron-left"></i> 自定义类型转换与格式化
    </a></div>
      <div class="post-nav-item">
    <a href="/blog/2020/03/08/%E8%A7%A3%E5%86%B3SpringMVC%E4%B8%AD%E7%9A%84%E4%B8%AD%E6%96%87%E4%B9%B1%E7%A0%81%E9%97%AE%E9%A2%98/" rel="next" title="解决SpringMVC中的中文乱码问题">
      解决SpringMVC中的中文乱码问题 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  

  </div>


          </div>
          
    <div class="comments" id="valine-comments"></div>

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#表单标签库"><span class="nav-text">表单标签库</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#form表单标签"><span class="nav-text">form表单标签</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#input标签、password标签、hidden标签、textarea标签"><span class="nav-text">input标签、password标签、hidden标签、textarea标签</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#checkbox标签-、checkboxes标签"><span class="nav-text">checkbox标签 、checkboxes标签</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#radiobutton标签-、radiobuttons标签"><span class="nav-text">radiobutton标签 、radiobuttons标签</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#select标签-、options标签"><span class="nav-text">select标签 、options标签</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#errors标签"><span class="nav-text">errors标签</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#数据绑定的应用"><span class="nav-text">数据绑定的应用</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="小郭"
      src="/blog/uploads/avatar.jpg">
  <p class="site-author-name" itemprop="name">小郭</p>
  <div class="site-description" itemprop="description">一个还在不断学习的编程小白！</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/blog/archives/">
        
          <span class="site-state-item-count">26</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/blog/categories/">
          
        <span class="site-state-item-count">7</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/blog/tags/">
          
        <span class="site-state-item-count">44</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/GZC986707252" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;GZC986707252" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://weibo.com/u/3278894871" title="微博 → https:&#x2F;&#x2F;weibo.com&#x2F;u&#x2F;3278894871" rel="noopener" target="_blank"><i class="fa fa-fw fa-weibo"></i>微博</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://blog.csdn.net/qq_41193133" title="CSDN → https:&#x2F;&#x2F;blog.csdn.net&#x2F;qq_41193133" rel="noopener" target="_blank"><i class="fa fa-fw fa-globe"></i>CSDN</a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:986707252@qq.com" title="E-Mail → mailto:986707252@qq.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
      </span>
  </div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">小郭</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> 强力驱动 v4.2.0
  </div>
  <span class="post-meta-divider">|</span>
  <div class="theme-info">主题 – <a href="https://theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a> v7.7.2
  </div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/blog/lib/anime.min.js"></script>
  <script src="/blog/lib/velocity/velocity.min.js"></script>
  <script src="/blog/lib/velocity/velocity.ui.min.js"></script>

<script src="/blog/js/utils.js"></script>

<script src="/blog/js/motion.js"></script>


<script src="/blog/js/schemes/pisces.js"></script>


<script src="/blog/js/next-boot.js"></script>


  <script defer src="/blog/lib/three/three.min.js"></script>
    <script defer src="/blog/lib/three/canvas_lines.min.js"></script>


  
  <script>
    (function(){
      var bp = document.createElement('script');
      var curProtocol = window.location.protocol.split(':')[0];
      bp.src = (curProtocol === 'https') ? 'https://zz.bdstatic.com/linksubmit/push.js' : 'http://push.zhanzhang.baidu.com/push.js';
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(bp, s);
    })();
  </script>




  
<script src="/blog/js/local-search.js"></script>













  

  


<script>
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
  NexT.utils.getScript('//unpkg.com/valine/dist/Valine.min.js', () => {
    var GUEST = ['nick', 'mail', 'link'];
    var guest = '昵称,邮箱,链接';
    guest = guest.split(',').filter(item => {
      return GUEST.includes(item);
    });
    new Valine({
      el         : '#valine-comments',
      verify     : false,
      notify     : true,
      appId      : 'dQIv9pCVNauk7ezmEU35I8sW-gzGzoHsz',
      appKey     : '2BGfzddNSeijXJJtTofkbuJx',
      placeholder: "走过路过，千万不要错过，一起聊聊吧！",
      avatar     : 'mm',
      meta       : guest,
      pageSize   : '10' || 10,
      visitor    : false,
      lang       : '' || 'zh-cn',
      path       : location.pathname,
      recordIP   : false,
      serverURLs : ''
    });
  }, window.Valine);
});
</script>

</body>
</html>